package com.mexico.inloancash.dialog;


import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.mexico.inloancash.R;
import com.mexico.inloancash.india_interfacedai.IndiaRewardDialogInterface;

public class India_User_Reward_CommonDialog extends Dialog{
    private Button sure_button;
    private ImageView cancel;
    private TextView reward_count;
    private IndiaRewardDialogInterface anInterface;
    private String count;
     public India_User_Reward_CommonDialog(@NonNull Context context, IndiaRewardDialogInterface dialogInterface, String count) {
        super(context,R.style.MyDialog);
        this.anInterface = dialogInterface;
        this.count = count;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.india_activity_reward_view_layout_dialog);
        Window win = getWindow();
        win.setGravity(Gravity.CENTER);
        WindowManager.LayoutParams lp = win.getAttributes();
        lp.width = WindowManager.LayoutParams.WRAP_CONTENT;
        lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
        win.setAttributes(lp);
        setCanceledOnTouchOutside(false);
        cancel = findViewById(R.id.cancel);
        sure_button = findViewById(R.id.sure_button);
        reward_count = findViewById(R.id.reward_count);
        cancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                anInterface.cancel();
                dismiss();
            }
        });
        sure_button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                anInterface.sure();
                dismiss();
            }
        });
        reward_count.setText(count);
    }
}
